<template>
    <div class="ueditor">
        <vue-ueditor-wrap v-model="ueditorcon" :config="editorConfig"></vue-ueditor-wrap>
    </div>
</template>


<script>
import VueUeditorWrap from 'vue-ueditor-wrap'; // ES6 Module
export default {
    name: 'UEditor',
    data() {
        return {
            ueditorcon: '',
            info_: null,
            editorConfig: {
                autoHeightEnabled: true, // 自动变高
                autoFloatEnabled: true,
                initialContent: '',
                autoClearinitialContent: true,
                initialFrameWidth: '100%', // 初始化宽
                initialFrameHeight: 500, // 初始化高
                // 访问 UEditor 静态资源的根路径，可参考 https://hc199421.gitee.io/vue-ueditor-wrap/#/faq
                UEDITOR_HOME_URL: "/statics/UEditor/",
                // 服务端接口（这个地址是我为了方便各位体验文件上传功能搭建的临时接口，请勿在生产环境使用！！！）
                serverUrl: "/api/common/ueditor_upload",
            },
        }
    },
    components: {
        VueUeditorWrap
    },
    props: {
        tinymceValue: {
            type: String,
            default: ''
        }
    },
    // 监听父组件传值的变化
    watch: {
        tinymceValue(curVal) {
            // console.log('watch')
            this.ueditorcon = curVal;
        }
    },
    mounted() {
        // tinymce.init({});
        // this.tinymceFlag++
        // console.log('this.tinymceValue -' + this.tinymceValue)
        this.ueditorcon = this.tinymceValue
    },
    beforeDestroy(){
        // tinymce.remove();
    },
    methods: {
    
    }
}
</script>